/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Where;

/**
 * 菜单表
 * 
 * @author aeky
 */
@Entity
@Table(name = "T_SYS_MENU")
public class Menu {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "MENU_ID", nullable = false, unique = true)
    private Long menuId;

    @Column(name = "MENU_NAME")
    private String menuName;

    @Column(name = "MENU_PARENT_ID")
    private Long menuParentId;

    @Column(name = "MENU_URL")
    private String menuUrl;

    @Column(name = "MENU_CODE")
    private String menuCode;

    @Column(name = "MENU_IMAGE_URL")
    private String menuImageUrl;

    @Column(name = "IS_VALID")
    private String isValid;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "MENU_PARENT_ID")
    @Where(clause = "IS_VALID = 1")
    private List<Menu> subMenus = new ArrayList<Menu>();

    /**
     * @return the menuId
     */
    public Long getMenuId() {
        return menuId;
    }

    /**
     * @param menuId the menuId to set
     */
    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    /**
     * @return the menuName
     */
    public String getMenuName() {
        return menuName;
    }

    /**
     * @param menuName the menuName to set
     */
    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    /**
     * @return the menuParentId
     */
    public Long getMenuParentId() {
        return menuParentId;
    }

    /**
     * @param menuParentId the menuParentId to set
     */
    public void setMenuParentId(Long menuParentId) {
        this.menuParentId = menuParentId;
    }

    /**
     * @return the menuUrl
     */
    public String getMenuUrl() {
        return menuUrl;
    }

    /**
     * @param menuUrl the menuUrl to set
     */
    public void setMenuUrl(String menuUrl) {
        this.menuUrl = menuUrl;
    }

    /**
     * @return the menuCode
     */
    public String getMenuCode() {
        return menuCode;
    }

    /**
     * @param menuCode the menuCode to set
     */
    public void setMenuCode(String menuCode) {
        this.menuCode = menuCode;
    }

    /**
     * @return the menuImageUrl
     */
    public String getMenuImageUrl() {
        return menuImageUrl;
    }

    /**
     * @param menuImageUrl the menuImageUrl to set
     */
    public void setMenuImageUrl(String menuImageUrl) {
        this.menuImageUrl = menuImageUrl;
    }

    /**
     * @return the isValid
     */
    public String getIsValid() {
        return isValid;
    }

    /**
     * @param isValid the isValid to set
     */
    public void setIsValid(String isValid) {
        this.isValid = isValid;
    }

    /**
     * @return the subMenus
     */
    public List<Menu> getSubMenus() {
        return subMenus;
    }

    /**
     * @param subMenus the subMenus to set
     */
    public void setSubMenus(List<Menu> subMenus) {
        this.subMenus = subMenus;
    }

}
